//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>

#include "ProcessCathFASTAProfile.h"
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
using namespace std;
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
int main (int argc, char** argv) {
  
  String* namefileFASTAProfileIn  = NULL;
  String* namefileFASTAProfileOut = NULL;

  if (argc < 3) {
    
    cout << "Error in the input parameters! Must by like: " << endl;
    cout << "./FillChemicalPhysicalClassification <Profile FASTA File In> <Profile FASTA File Out>" << endl;
    
    return 0;
    
  }
  else {
    
    namefileFASTAProfileIn  = new String(argv[1]);
    namefileFASTAProfileOut = new String(argv[2]);
    
    cout << "---------------------------------------------------------------------------------" << endl;
    cout << "     Profile FASTA File In : " << argv[1] << endl;
    cout << "    Profile FASTA File Out : " << argv[2] << endl;
    cout << "---------------------------------------------------------------------------------" << endl;
    
  }
  
  ProcessCathFASTAProfile* processCathFASTAProfile = new ProcessCathFASTAProfile ();
  
  cout << "Preparing Files..." << endl;
  processCathFASTAProfile->NamefileIn(namefileFASTAProfileIn);
  processCathFASTAProfile->NamefileOut(namefileFASTAProfileOut);
  
  cout << "Loading Profile FASTA File with Domain Descriptions..." << endl;
  processCathFASTAProfile->LoadData();
  
  cout << "Number of Domains: " << processCathFASTAProfile->ListCathDomainProfile()->Length() << endl;
    
  cout << "Fill Chemical and Physical Information by Residues in each Sequence..." << endl;
  processCathFASTAProfile->FillResiduesClassification();
  
  cout << "Writing the Out File..." << endl;
  processCathFASTAProfile->OutFilterFile();
  
  cout << "Finished..." << endl << "Good Bye" << endl;

  if (processCathFASTAProfile) delete processCathFASTAProfile;
  
  if (namefileFASTAProfileIn)  delete namefileFASTAProfileIn;
  if (namefileFASTAProfileOut) delete namefileFASTAProfileOut;

  return EXIT_SUCCESS;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//

